import React from 'react';
import { Redirect } from 'umi';
import { ConnectProps } from '@/models/connect';
import { queryToken } from '@/utils/token';

interface SecurityLayoutProps extends ConnectProps {
  loading: boolean;
}

class SecurityLayout extends React.Component<SecurityLayoutProps> {
  componentDidMount() {

  }

  render() {
    const { children } = this.props;
    const token = queryToken();
    if (!token) {
      return <Redirect to="/user/login"></Redirect>;
    }
    return children;
  }
}

export default SecurityLayout;